package com.water_work_form.result;

public class ResultUtil {

    /**
     * 成功返回
     */
    public static Result success(ResultCodeEnum codeEnum){
        return new Result(codeEnum.getCode(),codeEnum.getMsg());
    }

    public static Result success(ResultCodeEnum codeEnum,Object data){
        return new Result(codeEnum.getCode(),codeEnum.getMsg(),data);
    }

    public static Result success(ResultCodeEnum codeEnum,String msg){
        return new Result(codeEnum.getCode(),msg);
    }

    public static Result success(int code,String msg){
        return new Result(code,msg);
    }

    public static Result success(int code,String msg,Object data){
        return new Result(code,msg,data);
    }

    public static Result error(ResultCodeEnum codeEnum){
        return new Result(codeEnum.getCode(),codeEnum.getMsg());
    }

    public static Result error(ResultCodeEnum codeEnum,String msg){
        return new Result(codeEnum.getCode(),msg);
    }

    public static Result error(int code,String msg){
        return new Result(code,msg);
    }
}
